<template>
	<view class="goods-fee">
		<view class="list-box" v-if="RecordList.length>0">
			<view class="li-row" v-for="(item,index) in RecordList" :key="index">
				<view class="li-row-item">
					<view class="li-row-item-li">
						<view class="li-row-item-li-label">
							时间：
						</view>
						<view class="li-row-item-li-text">
							{{item.createTime}}
						</view>
					</view>
					<view class="li-row-item-li">
						<view class="li-row-item-li-label">
							数量：
						</view>
						<view class="li-row-item-li-text">
							{{item.amount}}
						</view>
					</view>
				</view>
				<view class="li-row-item">
					<view class="li-row-item-li">
						<view class="li-row-item-li-label">
							关联单号：
						</view>
						<view class="li-row-item-li-text">
							{{item.tradeNo}}
						</view>
					</view>
					<view class="li-row-item-li">
						<view class="li-row-item-li-label">
							状态：
						</view>
						<view class="li-row-item-li-text">
							{{item.status==0?"待入账":"已到账"}}
						</view>
					</view>
				</view>
				<view class="li-row-item">
					<view class="li-row-item-li">
						<view class="li-row-item-li-label">
							方向：
						</view>
						<view class="li-row-item-li-text">
							{{item.direction=="IN"?"收入":"支出"}}
						</view>
					</view>
					<view class="li-row-item-li">
						<view class="li-row-item-li-label">
							业务类型：
						</view>
						<view class="li-row-item-li-text">
							{{getbizType(item.bizType)}}
						</view>
					</view>
				</view>
			</view>
		</view>
		<view class="nodata" v-else>暂无数据</view>

	</view>

</template>

<script>
	import {
		getStoreData,
		setStoreData,
		httpPost,
		httpGet
	} from "@/utils/http.js";
	const date = new Date();
	const year = date.getFullYear();
	const month =
		date.getMonth() + 1 > 9 ? date.getMonth() + 1 : "0" + (date.getMonth() + 1);
	const date1 = date.getDate() > 9 ? date.getDate() : "0" + date.getDate();
	export default {
		data() {
			return {
				showFlag: false,
				RecordList: [],
				totalPrice: "",
				status: "loadmore",
				loadingText: "努力加载中",
				loadmoreText: "",
				nomoreText: "",
				count: 0,
				listInfo: {
					pageNo: 1,
					pageSize: 10,
				},
			};
		},
		onLoad() {

		},
		onShow() {
			this.getRecordList();
		},
		onReachBottom() {
			if (this.count >= 10) {
				this.status = "loading";
				this.listInfo.pageNo++;
				this.getRecordList();

			} else {
				this.status = "nomore";
			}
		},
		methods: {

			getRecordList() {
				const _this = this;

				httpPost("/api/union/store/integralAddLogList", {
						pageNo: this.listInfo.pageNo,
						pageSize: 10,
						direction:"OUT"
					})
					.then((res) => {
						_this.count = res.data.list.length;
						_this.RecordList = [..._this.RecordList, ...res.data.list];
						console.log(999, _this.RecordList)
						if (_this.count < 10) {
							_this.status = "nomore";
							_this.nomoreText = "没有更多了";
						} else {
							_this.status = "loading";
							_this.nomoreText = "";
						}

					})
					.catch((e) => {

					});
			},
			getbizType(type) {
				let val = Number(type);
				let typeText = "";
				switch (val) {
					case 1:
						typeText = "让利分红积分";
						break;
					case 2:
						typeText = "让利补贴积分";
						break;
					case 3:
						typeText = "传统补贴积分";
						break;
					case 4:
						typeText = "消费者共享金";
						break;
					case 5:
						typeText = "商家共享金";
						break;
					case 6:
						typeText = "消费者加速积分";
						break;
					case 7:
						typeText = "商家加速积分";
						break;
					case 8:
						typeText = "排队分润金";
						break;
					case 9:
						typeText = "盈利共享分润";
						break;
					case 10:
						typeText = "贡献奖励"; //服务商直推会员贡献奖励
						break;
					case 11:
						typeText = "贡献奖励"; //服务商推荐商家会员跨界贡献奖励
						break;
					case 12:
						typeText = "服务商分润-让利订单";
						break;
					case 13:
						typeText = "服务商分润-商家粉丝跨界";
						break;
					case 14:
						typeText = "服务商分润-让利业绩极差";
						break;
					case 15:
						typeText = "服务商分润-直推奖励";
						break;
					case 16:
						typeText = "代理商分润-让利订单";
						break;
					case 17:
						typeText = "公司分润-让利订单";
						break;
					case 18:
						typeText = "合伙人分润";
						break;
					case 20:
						typeText = "抵消分红积分";
						break;
					case 21:
						typeText = "冻结分红积分";
						break;
					case 22:
						typeText = "扣减共享金";
						break;
					case 23:
						typeText = "服务商分润-传统订单";
						break;
					case 24:
						typeText = "代理商分润-传统订单";
						break;
					case 25:
						typeText = "公司分润-传统订单";
						break;
					case 26:
						typeText = "商家共享分润-传统订单";
						break;
					case 51:
						typeText = "线下消费";
						break;
					case 52:
						typeText = "线上消费";
						break;
					case 53:
						typeText = "提现";
						break;
					case 54:
						typeText = "消费退款";
						break;
					default:
						typeText
						break;
				}
				return typeText
			}
		},
	};
</script>

<style lang="scss">
	.list-box {
		padding-left: 30rpx;
		padding-right: 30rpx;

		.li-row {
			padding: 30rpx;
			background-color: #fff;
			border-radius: 10rpx;

			.li-row-item {
				display: flex;
				flex-direction: row;
				justify-content: space-between;
				margin-bottom: 20rpx;

				.li-row-item-li {
					width: 50%;
					display: flex;
					flex-direction: row;
					justify-content: flex-start;
					font-size: 24rpx;

					.li-row-item-li-label {
						color: #666;
					}
				}
			}

			.li-row-item:nth-last-child(1) {
				margin-bottom: 0;
			}
		}
	}

	.nodata {
		text-align: center;
		color: #c5c5c5;
		padding-top: 50rpx;
	}
</style>